#ifndef __MSTRING_H
#define __MSTRING_H
#include "stdtype.h"

#define mx_str_foreach(str, pc, ...) {  \
    mx_string_pt pc;    \
    for (pc = str; *pc != '\0'; pc++) {    \
        __VA_ARGS__ \
    }   \
}

#define mx_str_foreachi(str, pc, i, ...) {  \
    mx_string_pt pc;    \
    mx_size_t i;    \
    for (pc = str, i = 0; *pc != '\0'; pc = &(str)[++i]) {    \
        __VA_ARGS__ \
    }   \
}

mx_size_t mx_strlen (const char* const s);
mx_size_t mx_strcmp (const char *p1, const char *p2);
void mx_memset (mx_uint8_pt addr, mx_uint8_t value, mx_usize_t size);
mx_string_pt mx_strtrim (mx_string_pt str);
mx_size_t mx_strsplitc (char* str, char c, char** arr);
mx_size_t mx_strsplitc_trim (char* str, char c, char** arr);
mx_bool_t mx_strisempt (char* str);
mx_void_pt mx_memcpy (mx_uint8_pt dest, mx_uint8_pt src, mx_usize_t count);
mx_string_pt mx_strcpy (mx_string_pt dst, mx_string_pt src);
char* mx_strncpy (char* dst, const char* src, mx_size_t n);
mx_size_t mx_strcn (mx_string_pt str, char c);
mx_size_t mx_strci (mx_string_pt str, char c);
mx_size_t mx_strcib (mx_string_pt str, char c);
mx_size_t mx_strciwn (mx_string_pt str, char c, mx_size_t num);
mx_size_t mx_strsi (mx_string_pt str, mx_string_pt s);
mx_size_t mx_strsib (mx_string_pt str, mx_string_pt s);
mx_bool_t mx_strisdigit (mx_string_pt str);
mx_int32_t mx_strtoi (mx_string_pt str);
mx_bool_t mx_strendwithc (mx_string_pt str, char c);
mx_bool_t mx_strstartwiths(mx_string_pt str, mx_string_pt s);
void mx_strreplacec (mx_string_pt str, char f, char t);

#endif
